package com.xxd.rpt2.Entity

import org.hibernate.mapping.Join

import javax.persistence.Entity
import javax.persistence.FetchType
import javax.persistence.GeneratedValue
import javax.persistence.Id
import javax.persistence.JoinColumn
import javax.persistence.JoinTable
import javax.persistence.ManyToMany
import javax.persistence.ManyToOne
import javax.persistence.Table
import javax.persistence.criteria.Fetch

/**
 * @Author XuXd
 * @Description: 权限角色
 * @CreateDate: 14:03 2019-09-11
 * @Modified by: *
 */
@Entity
@Table(name="rpt2_role")
class Role {
    @Id
    @GeneratedValue
    int id
    String name
    String code
    @ManyToOne
    @JoinColumn(name="type_id",referencedColumnName = "id")
    RoleType roleType

    @ManyToMany(fetch = FetchType.EAGER)
    @JoinTable(name="rpt2_role_menu",joinColumns = [@JoinColumn(name="role_id",referencedColumnName = "id") ],
    inverseJoinColumns = [@JoinColumn(name="menu_id",referencedColumnName = "id")])
    List<Menu> menuList
}
